<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>好好吃商城</title>
<link type="text/css" href="css/css.css" rel="stylesheet" />
 <script type="text/javascript" src="js/vue.js"></script>
 <script type="text/javascript" src="js/jquery.min.js"></script>
 <script type="text/javascript" src="js/js.js"></script>
</head>

<body style=" background:#FFF;">
<div id="app">
 <div class="loginLogo" >
  <div class="logoMid">
   <h1 class="logo" style="height:71px;padding-top:10px;"><a href="index.html"><img src="img/logo.png" width="241" height="71" /></a></h1>
   <div class="loginReg">
    还没有会员账号?&nbsp;<a href="reg.html">免费注册</a>
   </div><!--loginReg/-->
  </div><!--logoMid/-->
 </div><!--loginLogo/-->
 <div class="loginBox">
  <div class="loginLeft">
   <img src="img/登陆图片.jpg" width="716" height="376" />
  </div><!--loginLeft/-->
  <div class="loginRight" >
   <h2>会员登录</h2>
   <h3>账户</h3>
   <input type="text" class="name" id="username" />
   <h3>密码</h3>
   <input type="password" class="pwd" id="password" />
   <div class="zhuangtai">
    <input type="checkbox" checked="checked"/> 下次自动登录
   </div><!--zhuangtai/-->
   <div class="subs">
    <input type="image" id="login" src="img/sub.jpg" class="submit" />
   </div>
  </div><!--loginRight/-->
 </div>

 </div><!--loginBox/-->
<script type="text/javascript" src="js/jquery.cookie.js"></script>
 <script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/config.js"></script>
 <script type="module">

  var app = new Vue({
     el:"#app",
     data: {
      username:"",
      password:""
     }
  })


  $("#login").click(function(){
 $.cookie('name', $("#username").val(),{path:'/'});
   $.cookie('name2', $("#username").val(),{path:'/'});


   $.ajax({
    url:config.USER_LOGIN,
    type:"post",
    dataType:"json",
    data:{
     "xh":$("#username").val(),
     "password":$("#password").val()
    },
    success:function (data) {


  if ($("#username").val()==''){
      alert("请输入正确的账号或密码")
     }else if (data.data.user=="密码错误"||data.data.user=="账号不存在") {
      alert("账号不存在或密码错误")



     }else {

      $(window).attr('location', 'index.html');
     }
    },
    error:function(){
     alert('服务器超时，请重试！');
    }

   })


  })


 </script>
</body>
</html>
